import $api from '.';

interface carousel {
  name: string;
  number: number | string;
  [key: string]: any;
}

// 添加店铺
export const addcarousel = function (data: carousel) {
  return $api.post('/carousel', data);
};

// 获取店铺列表
export const getcarousel = function (data: { $limit: number; $skip: number }) {
  console.log('data', data);
  data.$limit = data.$limit || 20;
  data.$skip = data.$skip || 0;
  return $api.get('/carousel', {
    params: data,
  });
};

// 删除店铺
export const delcarousel = function (id: number) {
  return $api.delete(`/carousel/${id}`);
};

// 修改店铺信息
export const updatecarousel = function (id: number, data: any) {
  return $api.patch(`/carousel/${id}`, data);
};
// 搜索店铺信息
export const searchcarousel = function (data: { $limit: number; $skip: number; carouselname: string; state: number}) {
  console.log('data', data);
  data.$limit = data.$limit || 20;
  data.$skip = data.$skip || 0;
  return $api.get('/carousel', {
    params: data,
  });
};

export default {};
